#pragma once

#include "arithmetic.h"
#include "render_system/gl_render_system_define.h"

class Trackball
{
public:
    GL_RENDER_SYSTEM_API Trackball();
    GL_RENDER_SYSTEM_API ~Trackball();

    GL_RENDER_SYSTEM_API void setBound(int leftTopX, int leftTopY, int iWidth, int iHeight);

    GL_RENDER_SYSTEM_API void startPoint(const glm::vec2& start);

    GL_RENDER_SYSTEM_API void endPoint(const glm::vec2& end);

    GL_RENDER_SYSTEM_API glm::mat4 GetRotateMatrix();

private:
    glm::vec3 map2Sphere(const glm::vec2& vec2);

private:
    glm::vec3 _startPoint;
    glm::vec3 _endPoint;

    glm::vec2 _leftTopPoint;
    glm::vec2 _windowSize;
};
